{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "8f814515",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[DEBUG] 处理字段 桩号、部位: K59+639圆管涵 → K59+639圆管涵\n",
      "[DEBUG] 处理字段 施工日期: 2024-05-31 00:00:00 → 2024年05月31日\n",
      "[DEBUG] 处理字段 检测、记录日期: 2024-05-31 00:00:00 → 2024年05月31日\n",
      "[-18, 5, 8, 30, -27]\n",
      "[DEBUG] 处理字段 管座或垫层宽度、厚度: [-18, 5, 8, 30, -27] → [('D10', -18), ('E10', 5), ('F10', 8), ('G10', 30), ('H10', -27)]\n",
      "[-31, -40, -49, -38, -46]\n",
      "[DEBUG] 处理字段 相邻管节底面错台: [-31, -40, -49, -38, -46] → [('D13', -31), ('E13', -40), ('F13', -49), ('G13', -38), ('H13', -46)]\n",
      "[DEBUG] 处理字段 自检员签字日期: 2024-05-31 00:00:00 → 2024年05月31日\n",
      "[DEBUG] 处理字段 质检负责人日期: 2024-05-31 00:00:00 → 2024年05月31日\n",
      "[DEBUG] 处理字段 核验项目1: 管座或垫层宽度、厚度 → 管座或垫层宽度、厚度\n",
      "[DEBUG] 处理字段 核验项目2: 相邻管节底面错台 → 相邻管节底面错台\n"
     ]
    }
   ],
   "source": [
    "    PROJECT_BASE_INFO ={\n",
    "    '施工单位':'浙江交工宏途交通建设有限公司',\n",
    "    '监理单位':'浙江浙中建设工程管理有限公司',\n",
    "    '单位工程':'路基工程',\n",
    "    '分部工程':'涵洞、通道',\n",
    "    '分项工程':'主体结构',\n",
    "    '施工日期':'2024/05/31',\n",
    "    '施工部位':'K59+639圆管涵',\n",
    "    '设计坐标(X,Y)':(3243273.926,509154.842),\n",
    "    '长':44.5,#圆管涵长度\n",
    "    '宽':4,#圆管涵宽度\n",
    "    '基础宽度':2759,\n",
    "    '基础厚度':300,\n",
    "    '基础顶高程':66035,\n",
    "    '设计高程':66,#基础高程\n",
    "    '断面尺寸长度':1250,\n",
    "    '断面尺寸宽度':275.9,\n",
    "    '断面尺寸高(厚)度':30,\n",
    "    '基础混凝土强度（砂浆）等级':'C25',\n",
    "    '基础设计混凝土（砂浆）用量':'15',\n",
    "    '基础实际混凝土（砂浆）用量':'16',\n",
    "    '护壁混凝土强度（砂浆）等级':'C25',\n",
    "    '护壁设计混凝土（砂浆）用量':'15',\n",
    "    '护壁实际混凝土（砂浆）用量':'16',\n",
    "    'JS107规则类型':'2',\n",
    "} \n",
    "    from js107_rule  import JS107_Rule\n",
    "    rule = JS107_Rule(PROJECT_BASE_INFO)\n",
    "    results = rule.process()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "170f1449",
   "metadata": {},
   "outputs": [],
   "source": [
    "ields_to_remove = ['平面尺寸（mm）','基础底面高程（mm）','基础顶面高程（mm）','轴线偏位（mm）','核验项目3','核验项目4']\n",
    "results = results[~results[\"内容名称\"].isin(ields_to_remove)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "e2641731",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>工作簿名称</th>\n",
       "      <th>工作表名称</th>\n",
       "      <th>单元格编号</th>\n",
       "      <th>内容名称</th>\n",
       "      <th>processed_values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>K7</td>\n",
       "      <td>桩号、部位</td>\n",
       "      <td>{'type': 'string', 'value': 'K59+639圆管涵', 'met...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>Q6</td>\n",
       "      <td>施工日期</td>\n",
       "      <td>{'type': 'date', 'value': '2024年05月31日', 'meta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>Q7</td>\n",
       "      <td>检测、记录日期</td>\n",
       "      <td>{'type': 'date', 'value': '2024年05月31日', 'meta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>D10</td>\n",
       "      <td>管座或垫层宽度、厚度</td>\n",
       "      <td>{'type': 'list_horizontal', 'value': [('D10', ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>D13</td>\n",
       "      <td>相邻管节底面错台</td>\n",
       "      <td>{'type': 'list_horizontal', 'value': [('D13', ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>M30</td>\n",
       "      <td>自检员签字日期</td>\n",
       "      <td>{'type': 'date', 'value': '2024年05月31日', 'meta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>R30</td>\n",
       "      <td>质检负责人日期</td>\n",
       "      <td>{'type': 'date', 'value': '2024年05月31日', 'meta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>B10</td>\n",
       "      <td>核验项目1</td>\n",
       "      <td>{'type': 'string', 'value': '管座或垫层宽度、厚度', 'met...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>JS107</td>\n",
       "      <td>JS107</td>\n",
       "      <td>B13</td>\n",
       "      <td>核验项目2</td>\n",
       "      <td>{'type': 'string', 'value': '相邻管节底面错台', 'meta'...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   工作簿名称  工作表名称 单元格编号        内容名称  \\\n",
       "0  JS107  JS107    K7       桩号、部位   \n",
       "1  JS107  JS107    Q6        施工日期   \n",
       "2  JS107  JS107    Q7     检测、记录日期   \n",
       "3  JS107  JS107   D10  管座或垫层宽度、厚度   \n",
       "4  JS107  JS107   D13    相邻管节底面错台   \n",
       "5  JS107  JS107   M30     自检员签字日期   \n",
       "6  JS107  JS107   R30     质检负责人日期   \n",
       "7  JS107  JS107   B10       核验项目1   \n",
       "8  JS107  JS107   B13       核验项目2   \n",
       "\n",
       "                                    processed_values  \n",
       "0  {'type': 'string', 'value': 'K59+639圆管涵', 'met...  \n",
       "1  {'type': 'date', 'value': '2024年05月31日', 'meta...  \n",
       "2  {'type': 'date', 'value': '2024年05月31日', 'meta...  \n",
       "3  {'type': 'list_horizontal', 'value': [('D10', ...  \n",
       "4  {'type': 'list_horizontal', 'value': [('D13', ...  \n",
       "5  {'type': 'date', 'value': '2024年05月31日', 'meta...  \n",
       "6  {'type': 'date', 'value': '2024年05月31日', 'meta...  \n",
       "7  {'type': 'string', 'value': '管座或垫层宽度、厚度', 'met...  \n",
       "8  {'type': 'string', 'value': '相邻管节底面错台', 'meta'...  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
